//
//  ClickEffectiveAreaButton.m
//  CommonKit
//
//  Created by guohongqi on 2021/7/8.
//

#import "HQClickEffectiveAreaButton.h"

@implementation HQClickEffectiveAreaButton

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
    // 获取bounds 实际大小
    CGRect bounds = self.bounds;
    self.clickArea = @"0.4";
    if (self.clickArea) {
        CGFloat area = [self.clickArea floatValue];
        CGFloat widthDelta = MAX(44.0 - area * bounds.size.width , .0);
        CGFloat heightDelta = MAX(44.0 - area * bounds.size.height, .0);
        //扩大bounds
        bounds = CGRectInset(bounds, -0.5 * widthDelta, -0.5 * heightDelta);
    }
    // 点击的点在新的bounds 中 就会返回YES
    return CGRectContainsPoint(bounds, point);
}


@end
